package task.www.lagou.entity;

import java.util.Objects;

public class Account {
    private int id;
    private String userName;
    private String card;
    private double balance;

    public Account() {
    }

    public Account(int id, String userName, String card, double balance) {
        this.id = id;
        this.userName = userName;
        this.card = card;
        this.balance = balance;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getCard() {
        return card;
    }

    public void setCard(String card) {
        this.card = card;
    }

    public double getBalance() {
        return balance;
    }

    public void setBalance(double balance) {
        this.balance = balance;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Account account = (Account) o;
        return id == account.id &&
                Double.compare(account.balance, balance) == 0 &&
                userName.equals(account.userName) &&
                card.equals(account.card);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, userName, card, balance);
    }

    @Override
    public String toString() {
        return "account{" +
                "id=" + id +
                ", userName='" + userName + '\'' +
                ", card='" + card + '\'' +
                ", balance=" + balance +
                '}';
    }
}
